<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="positionDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='positionDetail.heading'/>"/>
</head>

<form:form commandName="position" method="post" action="/app/positionform" id="positionForm" onsubmit="return validatePosition(this)">
<form:errors path="*" cssClass="error" element="div"/>
<form:hidden path="id"/>
<ul>
    <li>
        <appfuse:label styleClass="desc" key="position.amount"/>
        <form:errors path="amount" cssClass="fieldError"/>
        <form:input path="amount" id="amount" cssClass="text medium" cssErrorClass="text medium error" maxlength="255"/>
    </li>
    <!-- todo: change this to read the identifier field from the other pojo -->
    <s:select name="position.company.id" list="companyList" listKey="id" listValue="id"></s:select>
    <li>
        <appfuse:label styleClass="desc" key="position.description"/>
        <form:errors path="description" cssClass="fieldError"/>
        <form:input path="description" id="description" cssClass="text medium" cssErrorClass="text medium error" maxlength="1000"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="position.exprience"/>
        <form:errors path="exprience" cssClass="fieldError"/>
        <form:input path="exprience" id="exprience" cssClass="text medium" cssErrorClass="text medium error" maxlength="50"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="position.location"/>
        <form:errors path="location" cssClass="fieldError"/>
        <form:input path="location" id="location" cssClass="text medium" cssErrorClass="text medium error" maxlength="50"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="position.salary"/>
        <form:errors path="salary" cssClass="fieldError"/>
        <form:input path="salary" id="salary" cssClass="text medium" cssErrorClass="text medium error" maxlength="50"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="position.school"/>
        <form:errors path="school" cssClass="fieldError"/>
        <form:input path="school" id="school" cssClass="text medium" cssErrorClass="text medium error" maxlength="50"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="position.title"/>
        <form:errors path="title" cssClass="fieldError"/>
        <form:input path="title" id="title" cssClass="text medium" cssErrorClass="text medium error" maxlength="50"/>
    </li>

    <li class="buttonBar bottom">
        <input type="submit" class="button" name="save" value="<fmt:message key="button.save"/>"/>
        <c:if test="${not empty position.id}">
        <input type="submit" class="button" name="delete" onclick="bCancel=true;return confirmDelete('position')"
            value="<fmt:message key="button.delete"/>" />
        </c:if>
        <input type="submit" class="button" name="cancel" value="<fmt:message key="button.cancel"/>" onclick="bCancel=true"/>
    </li>
</ul>
</form:form>

<v:javascript formName="position" cdata="false" dynamicJavascript="true" staticJavascript="false"/>
<script type="text/javascript" src="<c:url value='/scripts/validator.jsp'/>"></script>

<script type="text/javascript">
    Form.focusFirstElement($('positionForm'));
</script>
